package utils

import (
	"context"
	"github.com/olivere/elastic/v7"
)

var (
	URL = "43.143.123.142:9200"
)

func Send(data interface{}) error {
	cient, err := elastic.NewClient(elastic.SetURL(URL), elastic.SetSniff(false))
	if err != nil {
		return err
	}
	_, err = cient.Index().Index("goods").BodyJson(data).Do(context.Background())
	if err != nil {
		return err
	}
	return nil
}
